#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int MON=1e9+7;
struct monster {
    ll all;
    ll dang;
};
struct honst {
    ll use;
    ll kill;
};
bool cmp(honst a, honst b) {
    double tmp1=(double)(a.kill) / (double)(a.use);
    double tmp2=(double)(b.kill) / (double)(b.use);
    return tmp1>tmp2;
}
monster mon[MON];
honst hon[1005];
int res[MON];
int main() {
    int n,m;
    bool flag;
    while (~scanf("%d%d", &n, &m)) {
        memset(res, 0, sizeof(res));
        for (int i=0; i<n; i++) {
            scanf("%d%d", &mon[i].all, &mon[i].dang);
        }
        for (int i=0; i<m; i++) {
            scanf("%d%d", &hon[i].use, &hon[i].kill);
        }
        sort (hon, hon+m, cmp);
        flag=true;
        for (int i=0; i<n; i++) {
            if (hon[0].kill-mon[i].)
        }
    }
    return 0;
}
